<template>
  <system-index @to-main-page="toMainPage">
    <group-bargain ref="groupBargain" :has-back="hasBack" @to-page="toPage"></group-bargain>
  </system-index>
</template>

<script>
  import SystemIndex from 'views/systemIndex';
  import GroupBargain from 'views/groupBargain';

  import mpMixins from '../mpMixins';

  export default {
    mixins: [mpMixins],

    data() {
      let pages = getCurrentPages();
      return {
        hasBack: pages.length > 1
      };
    },

    created() {
      window.addEventListener('pulldownrefresh', () => {
        this.$refs['groupBargain'].resetData().then(() => {
          wx.stopPullDownRefresh();
        });
      });
    },

    components: {
      SystemIndex,
      GroupBargain
    }
  };

</script>
